package com.yj.jason.jsondemo;

import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.AppBarLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import com.yj.jason.baselibrary.utils.StatusBarUtil;
import com.yj.jason.baselibrary.view.RecyclerView.CommonAdapter.CommonRecyclerAdapter;
import com.yj.jason.baselibrary.view.RecyclerView.CommonAdapter.ViewHolder;

import java.util.ArrayList;
import java.util.List;

public class MDCoolapsingActivity extends AppCompatActivity{

        private RecyclerView recyclerView;
        private AppBarLayout app_bar_layout;
        private Toolbar toolbar;
        private View view;
        private List<String> mList=new ArrayList<>();

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_coolapsing);
        StatusBarUtil.setActivityTransluctent(MDCoolapsingActivity.this);
        recyclerView=findViewById(R.id.recyclerView);
        app_bar_layout=findViewById(R.id.app_bar_layout);
        toolbar=findViewById(R.id.toolbar);
        view=findViewById(R.id.view);

        setSupportActionBar(toolbar);
       // toolbar.setTitle("我是头部");

        for(int i=0;i<20;i++){
            mList.add("dfjfj "+i);
        }

        recyclerView.setLayoutManager(new LinearLayoutManager(this));

        recyclerView.setAdapter(new CommonRecyclerAdapter<String>(this,mList,R.layout.item_2) {
            @Override
            public void convert(ViewHolder holder, final String item) {
                holder.setText(R.id.tv_item,item);

            }


        });


        app_bar_layout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
            @Override
            public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
                Log.i("tags","verticalOffset=="+verticalOffset);
                Log.i("tags","appbar=="+appBarLayout.getTotalScrollRange());

                if (verticalOffset == 0) {
                } else if (Math.abs(verticalOffset) >= appBarLayout.getTotalScrollRange()) {
                } else{


                }



            }
        });
    }


}
